package org.zachary.creditbusiness.commodityandhouse.service;

import org.zachary.creditbusiness.commodityandhouse.entity.Commodity;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

public interface CommodityService {
    Commodity getCommodityById(Integer id);
    List<Commodity> getAllCommodities();
    Commodity createCommodity(Commodity commodity);
    Commodity updateCommodity(Commodity commodity);
    void deleteCommodity(Integer id);

    // 分页相关方法
    Page<Commodity> getCommodities(int page, int size);
    Page<Commodity> searchByName(String name, int page, int size);
    Page<Commodity> filterByCategory(String category, int page, int size);
    Page<Commodity> filterByPriceRange(Double minPrice, Double maxPrice, int page, int size);
    Page<Commodity> filterCommodities(String name, String category, Double minPrice, Double maxPrice, int page, int size);

    // 保留原有的不分页方法（用于其他地方可能的调用）
    List<Commodity> searchByName(String name);
    List<Commodity> filterByCategory(String category);
    List<Commodity> filterByPriceRange(Double minPrice, Double maxPrice);







    // 根据用户ID获取购买最多的前三个商品
    List<org.zachary.creditbusiness.commodityandhouse.dto.CommodityWithPurchaseCount> getTopThreePurchasedCommoditiesByUserId(Integer userId);





}
